<template>
  <div class="add-dialog">
    <el-dialog :before-close="handleCancel" :visible.sync="dialog" title="添加机构">
      <el-form :model="form" label-width="100px">
        <el-form-item label="机构">
          <el-input v-model="form.username" style="width:400px"/>
          <p style="color:#7a7a7a;margin:0">只能添加系统中已注册机构</p>
        </el-form-item>
        <el-form-item label="购买价格">
          <el-input v-model="form.price" style="width:380px"/>&nbsp;元
          <p style="margin:0">本课程的价格为{{ form.price }}元</p>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.remark" style="width:400px"/>
          <p style="margin:0">选填</p>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleCancel">取 消</el-button>
        <el-button type="primary" @click="handlePush">保 存</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    visibleDialog: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      form: {
        username: '学生会长',
        price: '1',
        remark: ''
      }
    }
  },
  computed: {
    dialog() {
      return this.visibleDialog
    }
  },
  methods: {
    handlePush() {
      this.$emit('closeAdd')
    },
    handleCancel() {
      this.$emit('closeAdd')
    }
  }
}
</script>

<style lang="scss">
.add-dialog {
  .el-dialog {
    width: 600px;
    border-radius: 5px;
  }
}
</style>
